require 'uri'

class PluginController < ApplicationController
  def method_missing plugin_name
    # $B%W%i%0%$%s%*%V%8%'%/%H$r@8@.$9$k(B
    if File.exist? "lib/wiki_plugin/#{plugin_name}/function.rb"
      require "lib/wiki_plugin/#{plugin_name}/function"
      eval("self.extend WikiPlugin::" + plugin_name.split('_').map{|w| w.capitalize}.join('') + "::Function")
      self.action
    end
    redirect_to URI.encode("#{_www_dir}#{params[:id]}") unless performed?
  end
end
